home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
lib
/
ansi
/
memset.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-19
|
561b
|
31 lines
#include <lib.h>
/* memset - set bytes
*
* CHARBITS should be defined only if the compiler lacks "unsigned char".
* It should be a mask, e.g. 0377 for an 8-bit machine.
*/
#include <string.h>
#ifndef CHARBITS
# define UNSCHAR(c) ((unsigned char)(c))
#else
# define UNSCHAR(c) ((c)&CHARBITS)
#endif
void *memset(s, ucharfill, size)
_VOIDSTAR s;
register int ucharfill;
size_t size;
{
register char *scan;
register size_t n;
register int uc;
scan = (char *) s;
uc = UNSCHAR(ucharfill);
for (n = size; n > 0; n--) *scan++ = uc;
return(s);
}